home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Scout-src.lha / netinclude / net / route.h < prev    next >
C/C++ Source or Header  |  2002-09-16  |  5KB  |  136 lines

  1. #ifndef NET_ROUTE_H
  2. #define NET_ROUTE_H \
  3.        "$Id: route.h,v 1.1.1.1 2001/11/26 22:21:14 tboeckel Exp $"
  4. /*
  5.  *      Generic Routing Routines
  6.  *
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development, Inc.
  9.  *                       All rights reserved.
  10.  */
  11.  
  12. /*
  13.  * These numbers are used by reliable protocols for determining
  14.  * retransmission behavior and are included in the routing structure.
  15.  */
  16. struct rt_metrics {
  17.     u_long    rmx_locks;    /* Kernel must leave these values alone */
  18.     u_long    rmx_mtu;    /* MTU for this path */
  19.     u_long    rmx_hopcount;    /* max hops expected */
  20.     u_long    rmx_expire;    /* lifetime for route, e.g. redirect */
  21.     u_long    rmx_recvpipe;    /* inbound delay-bandwith product */
  22.     u_long    rmx_sendpipe;    /* outbound delay-bandwith product */
  23.     u_long    rmx_ssthresh;    /* outbound gateway buffer limit */
  24.     u_long    rmx_rtt;    /* estimated round trip time */
  25.     u_long    rmx_rttvar;    /* estimated rtt variance */
  26. };
  27.  
  28. /*
  29.  * rmx_rtt and rmx_rttvar are stored as microseconds;
  30.  * RTTTOPRHZ(rtt) converts to a value suitable for use
  31.  * by a protocol slowtimo counter.
  32.  */
  33. #define    RTM_RTTUNIT    1000000    /* units for rtt, rttvar, as units per sec */
  34. #define    RTTTOPRHZ(r)    ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
  35.  
  36. #define    RTF_UP        0x1        /* route useable */
  37. #define    RTF_GATEWAY    0x2        /* destination is a gateway */
  38. #define    RTF_HOST    0x4        /* host entry (net otherwise) */
  39. #define    RTF_REJECT    0x8        /* host or net unreachable */
  40. #define    RTF_DYNAMIC    0x10        /* created dynamically (by redirect) */
  41. #define    RTF_MODIFIED    0x20        /* modified dynamically (by redirect) */
  42. #define RTF_DONE    0x40        /* message confirmed */
  43. #define RTF_MASK    0x80        /* subnet mask present */
  44. #define RTF_CLONING    0x100        /* generate new routes on use */
  45. #define RTF_XRESOLVE    0x200        /* external daemon resolves name */
  46. #define RTF_LLINFO    0x400        /* generated by ARP or ESIS */
  47. #define RTF_PROTO2    0x4000        /* protocol specific routing flag */
  48. #define RTF_PROTO1    0x8000        /* protocol specific routing flag */
  49.  
  50. /*
  51.  * Routing statistics.
  52.  */
  53. struct    rtstat {
  54.     short    rts_badredirect;    /* bogus redirect calls */
  55.     short    rts_dynamic;        /* routes created by redirects */
  56.     short    rts_newgateway;        /* routes modified by redirects */
  57.     short    rts_unreach;        /* lookups which failed */
  58.     short    rts_wildcard;        /* lookups satisfied by a wildcard */
  59. };
  60.  
  61. /*
  62.  * Following structure necessary for 4.3 compatibility;
  63.  * We should eventually move it to a compat file.
  64.  */
  65. struct ortentry {
  66.     u_long    rt_hash;        /* to speed lookups */
  67.     struct    sockaddr rt_dst;    /* key */
  68.     struct    sockaddr rt_gateway;    /* value */
  69.     short    rt_flags;        /* up/down?, host/net */
  70.     short    rt_refcnt;        /* # held references */
  71.     u_long    rt_use;            /* raw # packets forwarded */
  72. #ifdef AMITCP
  73.     char    rt_pad[4];
  74. #else
  75.     struct    ifnet *rt_ifp;        /* the answer: interface to use */
  76. #endif
  77. };
  78.  
  79. /*
  80.  * Structures for routing messages.
  81.  */
  82. struct rt_msghdr {
  83.     u_short    rtm_msglen;    /* to skip over non-understood messages */
  84.     u_char    rtm_version;    /* future binary compatability */
  85.     u_char    rtm_type;    /* message type */
  86.     u_short    rtm_index;    /* index for associated ifp */
  87.     pid_t    rtm_pid;    /* identify sender */
  88.     int    rtm_addrs;    /* bitmask identifying sockaddrs in msg */
  89.     int    rtm_seq;    /* for sender to identify action */
  90.     int    rtm_errno;    /* why failed */
  91.     int    rtm_flags;    /* flags, incl. kern & message, e.g. DONE */
  92.     int    rtm_use;    /* from rtentry */
  93.     u_long    rtm_inits;    /* which metrics we are initializing */
  94.     struct    rt_metrics rtm_rmx; /* metrics themselves */
  95. };
  96.  
  97. struct route_cb {
  98.     int    ip_count;
  99.     int    ns_count;
  100.     int    iso_count;
  101.     int    any_count;
  102. };
  103.  
  104. #define RTM_VERSION    2    /* Up the ante and ignore older versions */
  105.  
  106. #define RTM_ADD        0x1    /* Add Route */
  107. #define RTM_DELETE    0x2    /* Delete Route */
  108. #define RTM_CHANGE    0x3    /* Change Metrics or flags */
  109. #define RTM_GET        0x4    /* Report Metrics */
  110. #define RTM_LOSING    0x5    /* Kernel Suspects Partitioning */
  111. #define RTM_REDIRECT    0x6    /* Told to use different route */
  112. #define RTM_MISS    0x7    /* Lookup failed on this address */
  113. #define RTM_LOCK    0x8    /* fix specified metrics */
  114. #define RTM_OLDADD    0x9    /* caused by SIOCADDRT */
  115. #define RTM_OLDDEL    0xa    /* caused by SIOCDELRT */
  116. #define RTM_RESOLVE    0xb    /* req to resolve dst to LL addr */
  117.  
  118. #define RTV_MTU        0x1    /* init or lock _mtu */
  119. #define RTV_HOPCOUNT    0x2    /* init or lock _hopcount */
  120. #define RTV_EXPIRE    0x4    /* init or lock _hopcount */
  121. #define RTV_RPIPE    0x8    /* init or lock _recvpipe */
  122. #define RTV_SPIPE    0x10    /* init or lock _sendpipe */
  123. #define RTV_SSTHRESH    0x20    /* init or lock _ssthresh */
  124. #define RTV_RTT        0x40    /* init or lock _rtt */
  125. #define RTV_RTTVAR    0x80    /* init or lock _rttvar */
  126.  
  127. #define RTA_DST        0x1    /* destination sockaddr present */
  128. #define RTA_GATEWAY    0x2    /* gateway sockaddr present */
  129. #define RTA_NETMASK    0x4    /* netmask sockaddr present */
  130. #define RTA_GENMASK    0x8    /* cloning mask sockaddr present */
  131. #define RTA_IFP        0x10    /* interface name sockaddr present */
  132. #define RTA_IFA        0x20    /* interface addr sockaddr present */
  133. #define RTA_AUTHOR    0x40    /* sockaddr for author of redirect */
  134.  
  135. #endif /* !NET_ROUTE_H */
  136.